<%@ page import="dex.micros_gdc.Task" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'task.label', default: 'Task')}" />
		<g:set var="projectEntityName" value="${message(code: 'project.label', default: 'Project')}" />
		<g:set var="resourceEntityName" value="${message(code: 'resource.label', default: 'Resource')}" />
		<g:set var="summaryEntityName" value="${message(code: 'summary.label', default: 'Task Summary')}" />
		<g:set var="testcaseEntityName" value="${message(code: 'testcase.label', default: 'Testcase')}" />
		<g:set var="overtimeEntityName" value="${message(code: 'overtime.label', default: 'OT')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
		<script>
			function resetMainWindowsSize(){
				var x=document.getElementsByTagName("html");

				x[0].style.width = window.screen.width;

				document.getElementsById("list-task").style.width = '100%'
		    }

			resetMainWindowsSize();
		</script>
	</head>
	<body>
		<a href="#list-task" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
				<li><g:link class="list" controller="project" action="list"><g:message code="default.list.label" args="[projectEntityName]" /></g:link></li>
				<li><g:link class="list" controller="resource" action="list"><g:message code="default.list.label" args="[resourceEntityName]" /></g:link></li>
				<%--<li><g:link class="list" controller="testcase" action="list"><g:message code="default.list.label" args="[testcaseEntityName]" /></g:link></li>--%>
				<li><g:link class="list" controller="summary" action="list"><g:message code="default.list.label" args="[summaryEntityName]" /></g:link></li>
				<li><g:link class="list" controller="overtime" action="list"><g:message code="default.list.label" args="[overtimeEntityName]" /></g:link></li>
			</ul>
		</div>
		<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
		</g:if>
		<div>
			<g:form action="search" method="POST">
				<table class="search-form">
					<tbody>
						<tr>
							<td width="5%" style="vertical-align: middle;">
								<label for="projectName">
									<g:message code="task.project.label" default="Project" />
								</label>
							</td>
							<td width="8%">
								<g:select name="projectName" from="${validProjects}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.projectName}"/>
							</td>

							<td width="4%" style="vertical-align: middle;">
								<label for="ActionType">
									<g:message code="task.project.label" default="Action Type" />
								</label>
							</td>

							<td width="8%">
								<g:select name="at" from="${Task.constraints.actionType.inList}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.at}"/>
							</td>

							<td width="4%" style="vertical-align: middle;">
								<label for="Status">
									<g:message code="task.project.label" default="Status" />
								</label>
							</td>
							<td width="8%">
								<g:select name="ts" from="${Task.constraints.status.inList}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.ts}"/>
							</td>

							<td width="4%" style="vertical-align: middle;">
								<label for="Status">
									<g:message code="task.project.label" default="Doc Type" />
								</label>
							</td>
							<td width="5%">
								<g:select name="dt" from="${Task.constraints.documentType.inList}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.dt}"/>
							</td>

							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="developer">
									<g:message code="task.deveoper.label" default="DEV" />
								</label>
							</td>
							<td width="8%">
								<g:select name="developer" from="${developers}" style="width:160px" noSelection="['':'-  Select All  -']" value="${params.developer}"/>
							</td>
							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="tester">
									<g:message code="task.tester.label" default="QA" />
								</label>
							</td>
							<td width="8%">
								<g:select name="tester" from="${testers}" style="width:140px" noSelection="['':'-  Select All  -']" value="${params.tester}"/>
							</td>
							<td width="6%">
								<label for="Find">
									<g:message code="task.find.label" default="Find" />
								</label>
							</td>
							<td width="10%">
								<g:textField name="findId" maxlength="20" value="${findId}" size="10"/>
							</td>
							<td width="12%">
								<g:submitButton name="search" class="search-button" value="${message(code: 'default.button.search.label', default: 'Search')}" />
							</td>
						</tr>
					</tbody>
				</table>
			</g:form>
		</div>
		<g:set var="pN" value="${params.projectName}" />
		<g:set var="dev" value="${params.developer}" />
		<g:set var="qa" value="${params.tester}" />
		<g:set var="pts" value="${params.ts}" />
		<g:set var="dts" value="${params.dt}" />
		<g:set var="fid" value="${params.findId}" />
		<g:set var="ats" value="${params.at}" />
		<div id="list-task" class="content scaffold-list" role="main">
			<table>
				<thead>
					<tr>

						<g:sortableColumn property="projectName" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.projectName.label', default: 'Project')}"/>

						<g:sortableColumn property="activityNumber" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.activityNumber1.label', default: 'Act #')}" />

						<g:sortableColumn property="feedbackNumber" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.feedbackNumber.label', default: 'FB #')}" />

						<g:sortableColumn property="actionType" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.actionType.label', default: 'AType')}" />

						<g:sortableColumn property="documentType" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.documentType1.label', default: 'DType')}" />

						<g:sortableColumn property="receivedDate" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.receivedDate.label', default: 'Rec Date')}" />

						<g:sortableColumn property="dueDate" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.dueDate.label', default: 'Due Date')}" />

						<g:sortableColumn property="completedDate" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.completedDate.label', default: 'Com Date')}" />

						<g:sortableColumn property="status" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.status.label', default: 'Status')}" />

						<g:sortableColumn property="rootCause" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.rootCause.label', default: 'Root Cause')}" />

						<g:sortableColumn property="ptsHour" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.ptsHour.label', default: 'PTS')}" />

						<g:sortableColumn property="estimateHour" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.estimateHour.label', default: 'EST')}" />

						<g:sortableColumn property="developer" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.developer.label', default: 'Dev')}" />

						<g:sortableColumn property="tester" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.tester.label', default: 'QA')}" />

						<g:sortableColumn property="comments" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]" title="${message(code: 'task.comment.label', default: 'Comments')}" />

					</tr>
				</thead>
				<tbody>
				<g:each in="${taskInstanceList}" status="i" var="taskInstance">
					<tr class="${(i % 2) == 0 ? (taskInstance.priority == 'High' ? 'high-priority' : 'even') : (taskInstance.priority == 'High' ? 'high-priority' : 'odd')}">

						<td><g:link action="show" id="${taskInstance.id}" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]">${fieldValue(bean: taskInstance, field: "projectName")}</g:link></td>

						<td>${fieldValue(bean: taskInstance, field: "activityNumber")}</td>

						<td>${fieldValue(bean: taskInstance, field: "feedbackNumber")}</td>

						<td>${fieldValue(bean: taskInstance, field: "actionType")}</td>

						<td>${fieldValue(bean: taskInstance, field: "documentType")}</td>

						<td><g:formatDate date="${taskInstance.receivedDate}" format="MM/dd/yyyy"/></td>

						<td><g:formatDate date="${taskInstance.dueDate}" format="MM/dd/yyyy"/></td>

						<td><g:formatDate date="${taskInstance.completedDate}" format="MM/dd/yyyy"/></td>

						<td>${fieldValue(bean: taskInstance, field: "status")}</td>

						<td>${fieldValue(bean: taskInstance, field: "rootCause")}</td>

						<td>${fieldValue(bean: taskInstance, field: "ptsHour")}</td>

						<td>${fieldValue(bean: taskInstance, field: "estimateHour")}</td>

						<td>${fieldValue(bean: taskInstance, field: "developer")}</td>

						<td>${fieldValue(bean: taskInstance, field: "tester")}</td>

						<td>${fieldValue(bean: taskInstance, field: "comments")}</td>

					</tr>
				</g:each>
				</tbody>
			</table>
			<div class="pagination">
				<g:paginate total="${taskInstanceTotal}" />
			</div>
			<export:formats formats="['excel']" params="[projectName:[pN], developer:[dev], tester:[qa], ts:[pts], dt:[dts], findId:[fid], at:[ats]]"/>
		</div>
	</body>
</html>
